package com.xxh.mqstudy.config;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FanoutConfig {

    //声明队列
    @Bean
    Queue myQueuenA(){
        return new Queue("QuenueA");
    }
    @Bean
    Queue myQueuenB(){
        return new Queue("QuenueB");
    }
    @Bean
    Queue myQueuenC(){
        return new Queue("QuenueC");
    }

    //声明交换机
    @Bean
    FanoutExchange exchange(){
        return new FanoutExchange("myfanoutExchange");
    }
    //绑定队列和交换机
    @Bean
    Binding bindA(){
        return BindingBuilder.bind(myQueuenA()).to(exchange());
    }
    @Bean
    Binding bindB(){
        return BindingBuilder.bind(myQueuenB()).to(exchange());
    }
    @Bean
    Binding bindC(){
        return BindingBuilder.bind(myQueuenC()).to(exchange());
    }

}
